package display;

import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.springframework.web.context.*;

import domain.*;

public class EliminarPais extends PageController {
  
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		PaisRepository paises = (PaisRepository) context.getBean("PaisRepository");
		try {
			String id = request.getParameter("id");
			int idPais = Integer.parseInt(id);
			Pais pais = new Pais();
			pais.setId(idPais);
			paises.deletePais(pais);
			response.sendRedirect("listaPaises");
		} catch (Exception e) {
			request.setAttribute("mensaje",e.getMessage());
			forward("/paginaError.jsp",request,response);
		}
	}
}